package xj.model.uml;

import static xj.model.uml.UMLModelConstants.ATTR_TYPE;

public class ActivityNode 
  extends NamedElement {

  public enum ActivityType {
      Computation, 
      Object, 
      DataStore, 
      Decision, 
      Merge, 
      Fork, 
      Join, 
      Initial, 
      Final, 
      Terminate, 
      Accept_Event, 
      Send_Event,
  }

  public ActivityNode() {
    this(null, ActivityType.Computation);
  }

  public ActivityNode(String name) {
    this(name, ActivityType.Computation);
  }

  public ActivityNode(ActivityType type) {
    this(null, type);
  }

  public ActivityNode(String name, ActivityType type) {
    super(name);
    setType(type);
    destructable = false;
  }

  public ActivityType getType() {
    return type;
  }

  public void setType(ActivityType type) {
    this.type = type;
    setAttribute(ATTR_TYPE, type);
  }

  @Override
  public String toString() {
    return "ActivityNode: name=" + name;
  }

  @Override
  public Object clone() throws CloneNotSupportedException {
    ActivityNode a = (ActivityNode) super.clone();
    a.setType(type);
    return a;
  }

  protected ActivityType type;

}
